<template>
	<view class="control">
		<view class="top">
			<u-swiper :list="data.slider" height="450rpx" :indicator="true"></u-swiper>
			<!-- <image :src="data.cover" mode="" style="width: 450rpx;width: 100%;"></image> -->
			<!-- <view
				style="width: 100%;height: 450rpx;background-color: #EDF5F5;display: flex;lex-direction: row; justify-content: center; align-items: center;">
				<image style="width: 100%;height: 450rpx;" :src="data.cover" mode="aspectFit"></image>
			</view> -->
			<view class="postion">
				<nav-bar :title="data.course_name" :color="navBarColor" :bg="navBarBg" />
			</view>
		</view>
		<view class="box-1">
			<!-- <image style="width: 100%" mode="widthFix" :src="data.cover"></image> -->
			<!-- <view class="box-list"> -->
			<!-- <u-swiper :list="data.slider" height="450rpx" :indicator="true"></u-swiper> -->
			<!-- </view> -->
			<view class="notice" style="display: flex; flex-direction: row;">
				<u-notice-bar :text="text1" bgColor="#f8fbff"  color="#333333" @click="openNotice"
				 icon="https://jiangsudiantuo2022.oss-cn-hangzhou.aliyuncs.com/img/c5607a289054f4440c72aa018357c87ab9341bbe.png">
				</u-notice-bar>
			<!-- 	<view style="width: 120rpx;font-weight: 500;font-size: 24rpx;color: #2F75FA;display: flex;justify-content: center; align-items: center;background-color: #f8fbff;">
					更多
				</view> -->
			</view>
			<view class="detail-box">
				<view class="detail-1">
					{{ data.name }}
				</view>
				<!-- <view class="" style="display: flex; flex-direction: row; align-items: center;margin-top: 20rpx;"> -->
					<!-- <view class=" flex-align"
						style="font-size: 22rpx;color: #2F75FA;background-color: #d5e3fe;border-radius: 8rpx;padding: 5rpx 10rpx;margin-right: 20rpx;">
						{{ data.course_name }}
					</view> -->
					<!-- <image style="width: 25rpx;height: 25rpx;" src="https://jiangsudiantuo2022.oss-cn-hangzhou.aliyuncs.com/img/f1c02d6507d5b869a8fa25b144993dc02a42e038.png" mode=""></image>
					<view style="color: #FE8C61;font-size: 24rpx;margin-left: 6rpx;">
						招生中
					</view> -->
				<!-- </view> -->
				<!-- <view class="detail-2">
					{{data.area_name}}
				</view> -->
				<view style="font-size: 24rpx;color: #4E6EAF;margin-top: 20rpx;display: flex; flex-direction: row; ">
					<view class="tags flex-align">
						{{ data.course_name }}
					</view>
					<view class="tags flex-align">
						{{ data.program_name }}
					</view>
					<view class="">
						{{data.area_name}}
					</view>
				</view>
				<view class="flex-between detail-4">
					<view style="font-size: 24rpx;color: #4E6EAF;display: flex; flex-direction: row; ">
						<view class="tags flex-align">
							{{ data.train_enum_name }}
						</view>
						<view class="price">剩余：{{ data.less_stock }}</view>
					</view>
					
					<view class="info"> {{data.display_time}}</view>
				</view>
			</view>
		</view>

		<!-- <view class="box-2">
			<view class="flex-between"> 
				<view class="name">适用校区</view>
				<view class="flex-align icon">
					<text>{{ data.withArea.area_name }}</text>
					<u-icon name="arrow-right" color="rgb(153,153,153)" size="14"></u-icon>
				</view>
			</view>
		</view> -->

		<view class="box-2" v-if="data.content">
			<view class="title">课程详情</view>
			<view class="u-content">
				<u-parse :content="data.content"></u-parse>
			</view>
		</view>

		<view class="footer flex-align">
			<view v-if="data.less_stock>0" class="btn" @click="selectAlertchang">开始报名</view>
			<view v-else class="btn_s" >库存不足</view>
		</view>

		<!-- 场馆 -->
		<con-alert :show="alertShow" @close="close" title="适用场馆">
			<view class="select-list">
				<view class="item flex-align" v-for="item in data.venues" :key="item">
					<view class="image">
						<u--image radius="5" :src="item.venue_thumb" width="100%" height="100%"></u--image>
					</view>
					<view class="detail">
						<view>
							<view class="name">
								{{ item.venue_name }}
							</view>
							<view class="timer"> 营业时间：{{ item.open_time }} </view>
						</view>

						<view class="flex-between bottom">
							<view class="flex-align" style="width: 70%">
								<u-icon name="map-fill" color="#cacaca" size="12"></u-icon>
								<text class="address">{{ item.address }}</text>
							</view>
							<view class="flex-align">
								<text>{{ item.phone }}</text>
								<u-icon name="phone" color="#cacaca" size="12"></u-icon>
							</view>
						</view>
					</view>
				</view>
			</view>
		</con-alert>
		<view v-if="xieyi"
			style="width: 100%; height: 100%;background-color:rgba(0, 0, 0, 0.6);  position: absolute;top:0;left:0;z-index: 997;">
		</view>
		<view v-if="xieyi" 
			style="width: 80%; height: 1000rpx;background-color: #fff;;position: absolute;top:300rpx;left:10%;z-index: 999;border-radius: 20rpx;">
			<view class="" style="display: flex;;justify-content: center;align-items: center;margin-top: 20rpx;">
				报名须知
			</view>
			<scroll-view scroll-y style="width: 100%;height: 790rpx;padding: 35rpx 35rpx 35rpx 35rpx;" >
				<u-parse :content="data.content"></u-parse>
			</scroll-view>
			<view class="" style="display: flex;justify-content: center;align-items: center;margin-top: 30rpx;">
				<view @click="offxieyi" style="width: 380rpx; height: 80rpx;background-color: #3e80fc;text-align: center;line-height: 80rpx;color: #fff;border-radius: 20rpx;">
					知道了
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import conAlert from "@/components/com-alert/com-alert.vue";
	const venues = require("@/api/venues/venues.js");
	import navbar from '@/mixins/navbar.js';
	export default {
		mixins: [navbar({
			navBarColor: '#000000'
		})],
		components: {
			conAlert,
		},
		data() {
			return {
				alertShow: false,
				data: {},
				navbarItems_1: '',
				text1: "",
				id: '',
				venue_id: '',
				train_enum_id: '',
				venue_name:'',
				xieyi:true

			};
		},
		onLoad(options) {
			console.log(options)
			const selectionArrs = JSON.parse(decodeURIComponent(options.selectionArr))
			this.data = selectionArrs
			console.log(this.data, 'this.data ')
			this.id = options.id;
			this.venue_id = options.venue_id;
			this.venue_name = options.venue_name;
			this.train_enum_id = options.train_enum_id;
			this.text1 = selectionArrs.enroll_notice
		},
		methods: {
			offxieyi(){
				this.xieyi = false
			},
			// 获取培训班详情
			async getTrainDetail() {
				let postData = {
					train_id: this.id,
					app_id: this.$https.weixinAppId,
					project_id: getApp().globalData.projectId,
				}
				let res = await train.getTrainDetail(postData);
				if (res.code == 1) {
					// 开始报名培训班1  开始报名长训2   开始报名小班3
					this.data = res.data.train;
				}
			},
			selectAlertchang() {
				let that = this
				uni.navigateTo({
					url: `./train_specs?selectionArr=${encodeURIComponent(JSON.stringify(this.data))}` +
						"&status=" + 1 + "&venue_id=" + this.venue_id + "&venue_name=" + this.venue_name
				})
			},
			close() {
				this.alertShow = false;
			},
			openStoreShow() {
				this.alertShow = true;
			},
		},
	};
</script>

<style lang="scss" scoped>
	.u-content {
		padding: 24rpx;
	}

	.control {
		width: 100%;
		background-color: #f3f3f3;
		height: 100vh;
		overflow-y: auto;
		// min-height: 100vh;
		padding-bottom: 140rpx;

		.back {
			position: fixed;
			top: 100rpx;
			left: 20rpx;
			z-index: 3;
		}

		.top {
			position: relative;
			width: 100%;

			.postion {
				position: absolute;
				width: 100%;
				top: 0;
				left: 0;
				box-sizing: border-box;
			}
		}

		.box-1 {
			.notice /deep/ .u-icon__img {
				width: 54rpx !important;
				height: 54rpx !important;
			}

			.box-list {
				display: block;
			}

			.header {
				background-color: #f8123e;
				height: 106rpx;
				padding-left: 30rpx;
				box-sizing: border-box;

				image {
					width: 77rpx;
					height: 70rpx;
					margin-right: 24rpx;
				}

				.price-1 {
					white-space: nowrap;
					color: rgb(255, 255, 255);
					font-size: 24rpx;
					font-weight: 500;

					text {
						font-size: 44rpx;
						font-weight: 700;
					}
				}

				.tag {
					background-color: rgb(201, 17, 52);
					border-radius: 10rpx;
					padding: 4rpx 0;
					color: rgb(255, 255, 255);
					font-size: 18rpx;
					padding: 0px 8rpx;
					margin-left: 10rpx;
				}

				.price-2 {
					color: rgb(255, 255, 255);
					font-size: 24rpx;
					font-weight: 500;
					white-space: nowrap;
					text-decoration: line-through;
				}

				.right {
					background-image: url("https://jiangsudiantuo2022.oss-cn-hangzhou.aliyuncs.com/img/fb107487b55578cce969722f50a8e34d8160773c.png");
					background-repeat: no-repeat;
					background-size: 100% 100%;
					width: 222rpx;
					height: 106rpx;
					display: flex;
					flex-direction: column;
					justify-content: center;
					align-items: center;

					.info {
						color: rgb(248, 18, 62);
						font-size: 20rpx;
						font-weight: 700;
						white-space: nowrap;
					}

					.time {
						@include flex;
						align-items: center;

						&__custom {
							margin-top: 15rpx;
							width: 33rpx;
							height: 33rpx;
							background-color: rgb(248, 18, 62);
							border-radius: 4px;
							display: flex;
							justify-content: center;
							align-items: center;

							&__item {
								color: #fff;
								font-size: 20rpx;
								text-align: center;
							}
						}

						&__doc {
							padding: 0px 4px;
						}
					}
				}
			}

			.detail-box {
				padding: 30rpx 18rpx 30rpx 23rpx;
				background-color: rgb(255, 255, 255);
				box-sizing: border-box;

				.tags {
					font-size: 22rpx;
					color: #2F75FA;
					background-color: #d5e3fe;
					border-radius: 8rpx;
					padding: 5rpx 10rpx;
					margin-right: 20rpx;
				}

				.detail-1 {
					color: rgb(51, 51, 51);
					font-size: 40rpx;
					font-weight: 700;
				}

				.detail-2 {
					margin-top: 20rpx;
					color: #999999;
					font-size: 24rpx;
					line-height: 36rpx;
				}

				.detail-3 {
					margin-top: 24rpx;

					.tag {
						padding: 3rpx 15rpx;
						background-color: rgb(240, 242, 245);
						border-radius: 4rpx;
						color: rgb(51, 51, 51);
						font-size: 24rpx;
						margin-right: 9rpx;
					}

					.info {
						color: rgb(136, 136, 136);
						font-size: 24rpx;
						font-weight: 700;
					}
				}

				.detail-4 {
					margin-top: 10rpx;

					.price {
						color: #4E6EAF;
						font-size: 24rpx;

						text {
							font-size: 44rpx;
							font-weight: 700;
						}
					}

					.info {
						color: rgb(136, 136, 136);
						font-size: 24rpx;
						font-weight: 700;
					}
				}
			}
		}

		.box-2 {
			margin-top: 20rpx;
			padding: 30rpx 30rpx;
			background-color: rgb(255, 255, 255);

			.title {
				color: rgb(47, 117, 250);
				font-size: 28rpx;
				font-weight: 700;
			}

			.name {
				color: rgb(47, 117, 250);
				font-size: 28rpx;
				font-weight: 700;
			}

			.icon {
				color: rgb(153, 153, 153);
				font-size: 28rpx;
				font-weight: 700;

				text {
					margin-right: 10rpx;
				}
			}
		}

		.box-3 {
			margin-top: 20rpx;
			padding: 40rpx 20rpx 40rpx 29rpx;
			color: rgb(51, 51, 51);
			font-size: 24rpx;
			font-weight: 700;
			background-color: rgb(255, 255, 255);

			.image-1 {
				padding: 0 24rpx;
				margin-bottom: 26rpx;

				image {
					width: 47rpx;
					height: 46rpx;
				}
			}
		}

		.box-4 {
			margin-top: 20rpx;
			padding: 0rpx 20rpx 40rpx 29rpx;
			color: rgb(51, 51, 51);
			background-color: rgb(255, 255, 255);

			.con {
				margin-top: 20rpx;
			}
		}

		.footer {
			position: fixed;
			width: 100%;
			background-color: white;
			bottom: 0;
			left: 0;
			padding: 20rpx 25rpx 20rpx 25rpx;
			box-sizing: border-box;

			.menu {
				display: flex;
				flex-direction: column;
				align-items: center;
				margin-right: 40rpx;

				image {
					width: 35rpx;
					height: 35rpx;
				}

				text {
					color: rgb(51, 51, 51);
					font-size: 24rpx;
					font-weight: 700;
					margin-top: 13rpx;
				}
			}

			.btn {
				flex: 1;
				color: rgb(255, 255, 255);
				font-size: 30rpx;
				padding: 26rpx 0;
				border-radius: 60rpx;
				background-color: #3e80fc;
				text-align: center;
				font-weight: 700;
			}
			.btn_s {
				flex: 1;
				color: rgb(255, 255, 255);
				font-size: 30rpx;
				padding: 26rpx 0;
				border-radius: 60rpx;
				background-color: #cecece;
				text-align: center;
				font-weight: 700;
			}
		}

		// 弹窗

		.select-list {
			.item {
				margin-bottom: 20rpx;
				padding-bottom: 20rpx;
				height: 150rpx;
				border-bottom: 1px solid #cccccc;

				&:last-of-type {
					border: none;
					margin: 0;
					padding: 0;
				}

				.image {
					width: 150rpx;
					height: 100%;

					/deep/ .vue-ref {
						width: 100%;
						height: 100%;
					}
				}

				.detail {
					display: flex;
					height: 100%;
					flex: 1;
					width: 0;
					margin-left: 20rpx;
					flex-direction: column;
					justify-content: space-between;

					.name {
						font-weight: 700;
						font-size: 28rpx;
						margin-bottom: 15rpx;
					}

					.timer {
						color: #cacaca;
						font-size: 20rpx;
					}

					.bottom {
						font-size: 20rpx;
						color: #cacaca;

						.address {
							width: 70%;
							white-space: nowrap;
							overflow: hidden;
							text-overflow: ellipsis;
						}
					}
				}
			}
		}

		.section {
			.select-list {
				.item {
					margin-bottom: 20rpx;
					padding-bottom: 20rpx;
					height: 50rpx;
					border-bottom: 1px solid #cccccc;
					padding: 0;

					&:last-of-type {
						border: none;
						margin: 0;
						padding: 0;
					}

					.image {
						width: 150rpx;
						height: 100%;

						/deep/ .vue-ref {
							width: 100%;
							height: 100%;
						}
					}

					.detail {
						display: flex;
						height: 100%;
						flex: 1;
						width: 0;
						margin-left: 20rpx;
						flex-direction: column;
						justify-content: space-between;

						.name {
							font-weight: 700;
							font-size: 28rpx;
							margin-bottom: 15rpx;
						}

						.timer {
							color: #cacaca;
							font-size: 20rpx;
						}

						.bottom {
							font-size: 20rpx;
							color: #101010;

							.address {
								width: 70%;
								white-space: nowrap;
								overflow: hidden;
								text-overflow: ellipsis;
							}
						}
					}
				}
			}

			.btns {
				background: linear-gradient(0deg, #528EFF, #2F75FA);
				border-radius: 20px;
				font-size: 28rpx;
				font-weight: bold;
				color: #FFFFFF;
				padding: 26rpx 0;
				margin: 0px 30rpx;
				margin-top: 120rpx;
				text-align: center;
			}

			.btns_s {
				background: linear-gradient(0deg, #bebebe, #bebebe);
				border-radius: 20px;
				font-size: 28rpx;
				font-weight: bold;
				color: #FFFFFF;
				padding: 26rpx 0;
				margin: 0px 30rpx;
				margin-top: 120rpx;
				text-align: center;
			}

			.btns_ms {
				// position: absolute;
				// right: 10rpx;
				// top: 110rpx;
				margin-left: 65%;
			}

			.btns_m {
				background: linear-gradient(0deg, #528EFF, #2F75FA);
				border-radius: 5px;
				font-size: 28rpx;
				font-weight: bold;
				color: #FFFFFF;
				padding: 26rpx 0;
				width: 160rpx;
				height: 60rpx;
				text-align: center;
				line-height: 12rpx;

			}

			.btns_s {
				background: linear-gradient(0deg, #bebebe, #bebebe);
				border-radius: 20px;
				font-size: 28rpx;
				font-weight: bold;
				color: #FFFFFF;
				padding: 26rpx 0;
				margin: 0px 30rpx;
				margin-top: 120rpx;
				text-align: center;
			}

			.section-1 {
				height: 200rpx;



				.image {
					width: 200rpx;
					height: 100%;
					margin-right: 26rpx;
					border-radius: 10rpx;
					overflow: hidden;

					image {
						width: 100%;
						height: 100%;
					}
				}

				.detail {
					flex: 1;
					width: 0;
					display: flex;
					height: 100%;
					flex-direction: column;
					justify-content: space-between;

					.detail-1 {
						font-size: 30rpx;
						font-weight: 600;
						margin-top: 10rpx;
						color: #333333;
					}

					.detail-2 {
						font-size: 24rpx;
						font-weight: 500;
						color: #888888;
						margin-top: 12rpx;
					}

					.price {
						font-size: 20rpx;
						font-weight: 500;
						color: #ff0000;

						text {
							font-size: 32rpx;
							font-weight: 700;
						}
					}
				}
			}

			.section-2 {
				margin-top: 50rpx;

				.top-menu-list {
					display: flex;
					flex-wrap: wrap;

					.top-menu-item {
						display: flex;
						flex-direction: column;
						align-items: center;
						width: 20%;
						// margin-top: 10rpx;
						padding: 0px 30rpx;
						box-sizing: border-box;
						font-size: 25rpx;

						.add_na {
							display: flex;
							flex-direction: column;
							align-items: center;
							width: 20%;
							// margin-top: 30rpx;
							padding: 0px 30rpx;
							box-sizing: border-box;
							font-size: 25rpx;

							.menu-image {
								width: 100rpx;
								height: 100rpx;
								// border-radius: 37rpx;
								// background: rgb(250, 237, 234);
								// background: linear-gradient(45deg,
								// 		rgba(250, 237, 234, 1) 0%,
								// 		rgba(246, 227, 216, 1) 77%);
								background: url('https://jiangsudiantuo2022.oss-cn-hangzhou.aliyuncs.com/img/60cb40ff572199778113a809978ef6aa0f09db36.png') 100% no-repeat;
								background-size: 100% 100%;
								// position: absolute;
								// top: 0;
								// right: 0;
								// z-index: 999;
								display: flex;
								justify-content: center;
								align-items: center;

								image {
									width: 60rpx;
									height: 60rpx;
								}
							}

							.menu-image-no-checked {
								width: 100rpx;
								height: 100rpx;
								display: flex;
								justify-content: center;
								align-items: center;

								image {
									width: 60rpx;
									height: 60rpx;
								}
							}

							.no-checked-text {
								white-space: nowrap;
							}

							.checked-text {
								margin-top: 20rpx;
								white-space: nowrap;
								font-weight: bold;
							}
						}
					}
				}

				.sub-title {
					font-size: 28rpx;
					font-weight: bold;
					color: #333333;
					margin-bottom: 20rpx;
				}



				.tag-list {
					display: flex;
					flex-wrap: wrap;

					/deep/.u-tag {
						margin-left: 30rpx;
						margin-bottom: 30rpx;
					}

					// .tag{
					// 	background: #EFEFEF;
					// 	border-radius: 3px;
					// 	font-size: 24rpx;
					// 	font-weight: 500;
					// 	color: #FFFFFF;
					// 	padding: 7rpx 20rpx;
					// 	margin-right: 20rpx;
					// 	margin-bottom: 20rpx;
					// }

				}
			}

			.section-3 {
				font-size: 22rpx;
				font-weight: 500;
				color: #333333;
			}
		}
	}
</style>